
const models = {
  'hr.payslip': {
    extend: BaseClass => {
      class cls extends BaseClass {
      }

      cls.compute_sheet = async (id, fields={}, kwargs={} ) => {
        return cls.call_as_write_read({
          method: 'compute_sheet',
          args: [ id ],
          kwargs,
        }, fields );
      }

      cls.action_payslip_done = async (id, fields={}, kwargs={} ) => {
        return cls.call_as_write_read({
          method: 'action_payslip_done',
          args: [ id ],
          kwargs,
        }, fields );
      }

      cls.action_payslip_draft = async (id, fields={}, kwargs={} ) => {
        // TBD 20190430:
        // 1: manualy unpost account.move of this payslip
        // 2: then manualy del account.move of this payslip
        // 3: check no account.move of this payslip
        // 4: set payslip.state= draft

        return cls.call_as_write_read({
          method: 'action_payslip_draft',
          args: [ id ],
          kwargs,
        }, fields );
      }

      return cls;
    },
  },

  'hr.payslip.run': {
    extend: BaseClass => {
      class cls extends BaseClass {
      }

      cls.draft_payslip_run = async (id, fields={}, kwargs={} ) => {
        return cls.call_as_write_read({
          method: 'draft_payslip_run',
          args: [ id ],
          kwargs,
        }, fields );
      }

      cls.close_payslip_run = async (id, fields={}, kwargs={} ) => {
        return cls.call_as_write_read({
          method: 'close_payslip_run',
          args: [ id ],
          kwargs,
        }, fields );
      }

        return cls;
    },
  },

//    'hr.payslip.line': {},
//    'hr.payslip.worked_days': {},
//    'hr.payslip.input': {},

};


export default {
  models,
};
